package ooday03;

public class TestDemo {
    public static void main(String[] args) {

            Dog[] dogs=new Dog[3];
            dogs[0]=new Dog("小黑",2,"黑");
            dogs[1]=new Dog("小白",1,"白");
            dogs[2]=new Dog("小灰",3,"灰");
            System.out.println(dogs[0].name);
            dogs[1].age=4;
            dogs[2].swim();
            for(int i=0;i< dogs.length;i++){
                System.out.println(dogs[i].name);
                dogs[i].eat();
            }

            Chick[] chicks=new Chick[2];
            chicks[0]=new Chick("大花",2,"橙");
            chicks[1]=new Chick("小花",1,"白");

            System.out.println(chicks[1].name);
            for(int j=0;j< chicks.length;j++){
                System.out.println(chicks[j].name);
                chicks[j].lay();
            }

            Fish[] fish=new Fish[2];
            fish[0]=new Fish("小金",1,"金色");
            fish[1]=new Fish("小黄",2,"黄色");
            System.out.println(fish[1].name);
            for(int k=0;k< fish.length;k++){
                System.out.println(fish[k].name);
            }


        }
    }
